﻿<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
    namespace="Agathas.Storefront.Model.Products"
        assembly="Agathas.Storefront.Model">

  <class name="ProductTitle" table="ProductTitles" lazy="false" >

    <id  name="Id" column="ProductTitleId"  type="int" unsaved-value="0">
      <generator class="native" />
    </id>
    
    <property access="field.camelcase-underscore"  name="Price">
      <column name="Price" sql-type="decimal(18, 2)" not-null="true" />
    </property>

    <property access="field.camelcase-underscore"  name="Name">
      <column name="ProductName" sql-type="nvarchar(50)" not-null="true" />
    </property>

    <many-to-one access="field.camelcase-underscore"  name="Colour"
                      class="ProductColour"
                      column="ColourId"
                      not-null="true"
                      lazy="false"
					  />

    <many-to-one access="field.camelcase-underscore"  name="Brand"
                      class="Brand"
                      column="BrandId"
                      not-null="true"
                      lazy="false"
					  />

    <many-to-one access="field.camelcase-underscore"  name="Category"
                      class="Agathas.Storefront.Model.Categories.Category"
                      column="CategoryId"
                      not-null="true"
                      lazy="false"
					  />
    
    <bag access="field.camelcase-underscore" name="Products" inverse="true" cascade="all" lazy="false" fetch="join"  >
      <key column="ProductTitleId"/>
      <one-to-many class="Product"></one-to-many>
    </bag>

  </class>

</hibernate-mapping>